*********************************************************************************
* "Women's leadership and the gendered consequences of austerity"
* (Replication file)
*
* Survey dataset
*********************************************************************************

* Data loading
**************
  
  use "IMFWPS_WVS_replication", clear
  

* Generate samples and medians

  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index married age i.education  children if  public==1 , absorb(cid year) cluster(cid)
  gen sample_worries=e(sample)
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index married age i.education  children if  public==1 , absorb(cid year) cluster(cid)
  gen sample_income=e(sample)
  tab year if sample_income
  gen median_women_worries=1 if women_share>.0930233
  replace median_women_worries=0 if median_women_worries==. & sample_worries==1
  gen median_women_income=1 if women_share>.0869565
  replace median_women_income=0 if median_women_income==. & sample_income==1


* Main analysis
***************

  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index married  age i.education  children income_3 savings if median_women_worries==0 & public==1, absorb(cid year) cluster(cid)
  estimates store m1
  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index married age i.education  children income_3 savings if median_women_worries==1 & public==1, absorb(cid year) cluster(cid)
  estimates store m2
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index married  age i.education children if median_women_income==0 & public==1, absorb(cid year) cluster(cid)
  estimates store m3
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index  married age i.education  children if median_women_income==1 & public==1, absorb(cid year) cluster(cid)
  estimates store m4

  ** Table 2 **
  estout m*, drop(_* 1.IMFnn *0.*) starlevels(* .1 ** .05 *** .01) cells(b(star fmt(3)) se(par fmt(3))) stats(N N_clust r2_a, fmt(0 0 3))
  
  
* Robustness
************

* Three-way-interaction

  qui reghdfe worries_job i.IMFnn##i.women##i.median_women_worries gender_equality_job_index income_3 savings married  age i.education  children  if  public==1, absorb(cid year) cluster(cid)
  estimates store R11
  qui reghdfe income_3 i.IMFnn##i.women##i.median_women_income gender_equality_job_index  married age i.education  children  if public==1, absorb(cid year) cluster(cid)
  estimates store R12

  ** Table A10 **
  estout R1*, drop(_*  *0.* 1.IMFnn 1.IMFnn*0.*) starlevels(* .1 ** .05 *** .01) cells(b(star fmt(3)) se(par fmt(3))) stats(N N_clust r2_a, fmt(0 0 3))


* Different cut-off: mean

  gen mean_women_worries=1 if women_share>.1
  replace mean_women_worries=0 if mean_women_worries==. & sample_worries==1
  gen mean_women_income=1 if women_share>.1
  replace mean_women_income=0 if mean_women_income==. & sample_income==1

  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index savings married income_3  age i.education  children  if mean_women_worries==0 & public==1, absorb(cid year) cluster(cid)
  estimates store R21
  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index savings married income_3 age i.education  children if mean_women_worries==1 & public==1, absorb(cid year) cluster(cid)
  estimates store R22
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index married  age i.education children if mean_women_income==0 & public==1, absorb(cid year) cluster(cid)
  estimates store R23
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index  married age i.education  children if mean_women_income==1 & public==1, absorb(cid year) cluster(cid)
  estimates store R24

  ** Table A11 **
  estout R2*, drop(_* *0.* 1.IMFnn ) starlevels(* .1 ** .05 *** .01) cells(b(star fmt(3)) se(par fmt(3))) stats(N N_clust r2_a, fmt(0 0 3))


* Placebo check: Private sector

  egen sample_worries_all=max(sample_worries), by(S024)
  egen sample_inc_all=max(sample_income), by(S024)
  gen median_women_worries_all=1 if women_share>.0930233
  replace median_women_worries_all=0 if median_women_worries==. & sample_worries_all==1
  gen median_women_income_all=1 if women_share>.0869565
  replace median_women_income_all=0 if median_women_income==. & sample_inc_all==1

  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index savings married income_3 age i.education  children  if median_women_income_all==0 & public!=1, absorb(cid year) cluster(cid)
  estimates store R31
  qui reghdfe worries_job i.IMFnn##i.women gender_equality_job_index savings married income_3 age i.education  children if median_women_worries_all==1 & public!=1, absorb(cid year) cluster(cid)
  estimates store R32
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index married  age i.education children if median_women_income_all==0 & public!=1, absorb(cid year) cluster(cid)
  estimates store R33
  qui reghdfe income_3 i.IMFnn##i.women gender_equality_job_index  married age i.education  children if median_women_income_all==1 & public!=1, absorb(cid year) cluster(cid)
  estimates store R34

  ** Table A12 **
  estout R3*, drop(_* *0.* 1.IMFnn) starlevels(* .1 ** .05 *** .01) cells(b(star fmt(3)) se(par fmt(3))) stats(N N_clust r2_a, fmt(0 0 3))

  
* Descriptives 
**************

  qui estpost su  worries_job income_3 IMFnn women public gender_eq married age education children savings if sample_income==1|sample_worries==1
  esttab ., cells("count mean sd min max")
  
  
  